program SuperLibrary32;

{$R *.dres}
{$R *.RES}

uses
  SysUtils,
  Classes,
  Windows,
  Forms,
  MemoryModule in 'XMemoryRun\MemoryModule.pas',
  uFrmStart in 'uFrmStart.pas' {FrmStart};

begin
{$IFDEF WIN64}
  ResourceLocation := FindResource(HInstance, 'SuperRing0x64', 'Dll');
{$ELSE}
  ResourceLocation := FindResource(HInstance, 'SuperRing0x32', 'Dll');
{$ENDIF}
  try
    if ResourceLocation <= 0 then
      Exit;
    ResourceSize := SizeofResource(HInstance, ResourceLocation);
    if ResourceSize <= 0 then
      Exit;
    ResourceHandle := LoadResource(HInstance, ResourceLocation);
    if ResourceHandle <= 0 then
      Exit;
    ResourcePointer := LockResource(ResourceHandle);
    if ResourcePointer = nil then
      Exit;
    hMod := MemLoadLibrary(ResourcePointer);
    if hMod <= 0 then
      Exit;
    try
      @TouchProc := MemGetProcAddress(hMod, 'TouchProc');
      TouchProc(Application);
    finally
      MemFreeLibrary(hMod);
    end;
  finally
    Application.Terminate;
  end;
end.

